function fft_data = FUN_plotDataFreq(fig,data )
%FUN_plotDataFreq Summary of this function goes here
%   Detailed explanation goes here

size = length(data);
sampletime = 0.01;                               %sample time that unit is second
t = 0:sampletime:(size-1) * sampletime;     %time point

figure_FontSize=12;     %normal 12 bigger 14
figure(fig);clf();subplot(2,1,1);
plot(t,data,'k');
% title('Time Domain Analysis');%axis([0 60 -200 200]);
xlabel('Time(s)'); ylabel('Amplitude');
set(get(gca,'XLabel'),'FontSize',figure_FontSize);
set(get(gca,'YLabel'),'FontSize',figure_FontSize);
% set(get(gca,'title'),'FontSize',figure_FontSize);

samplefreq = 1/sampletime;                        %sample frequency that unit is Hz
f = (0:(size-1))/size*samplefreq;           %frequency point
data = data - mean(data);
fft_data=fft(data);
fft_data_abs=abs(fft_data);

figure(fig);subplot(2,1,2);
plot(f,fft_data_abs,'k');
% title('Frequency Domain Analysis'); axis auto %axis([0 100 0 10^6]);
xlabel('Frequency(Hz)'); ylabel('Amplitude');
set(get(gca,'XLabel'),'FontSize',figure_FontSize);
set(get(gca,'YLabel'),'FontSize',figure_FontSize);

end

